// 引入request
import request from '@/utils/request'
/**
 *获取文章列表
 * @param {Object} params
 * @returns
 */
export const getArticleList = params => {
  return request({
    method: 'GET',
    url: '/v1_1/articles',
    params
  })
}
/**
 *获取新闻文章详情
 * @param {String} id
 * @returns
 */
export const getArticleInfo = id => {
  return request({
    method: 'GET',
    url: `/v1_0/articles/${id}`
  })
}
/**
 *给文章收藏
 * @param {Objeat Number} target
 * @returns
 */
export const addArticleCollected = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target
    }
  })
}
/**
 *取消文章收藏
 * @param {*} target
 * @returns
 */
export const deleteArticleCollected = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${target}`
  })
}
/**
 *取消文章点赞
 * @param {*} target
 * @returns
 */
export const deleteArticleGood = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${target}`
  })
}
/**
 *添加文章点赞
 * @param {*} target
 * @returns
 */
export const addArticleGood = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target
    }
  })
}

/**
/  *对文章不喜欢
 * @param {*} target
 * @returns
 */
export const disArticleGood = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/dislikes',
    data: {
      target
    }
  })
}
